package first;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import javax.servlet.http.HttpSession;
import java.lang.String;



@WebServlet(name = "EditServlet",urlPatterns = {"/login/Edit"})
public class EditServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        HttpSession session=request.getSession();
        String username=request.getParameter("username");
        String postbox=request.getParameter("postbox");
        String fname=request.getParameter("fname");
        String sname=request.getParameter("sname");
        String depertment=request.getParameter("department");
        String object=request.getParameter("object");
        String url=request.getParameter("url");
        System.out.println(username);
        EditBean edit = new EditBean();
        edit.writeFile(edit.readFileContent(username,postbox,fname,sname,depertment,object));

        session.setAttribute("username",username);
        session.setAttribute("usename","usename");
        session.setAttribute("url",url);
        response.sendRedirect("http://localhost:8080/individual.jsp");
    }
}
